package impl.sdi.business;




import impl.sdi.business.classes.UsersAlta;
import impl.sdi.business.classes.UsersBaja;
import impl.sdi.business.classes.UsersBuscar;
import impl.sdi.business.classes.UsersListado;
import impl.sdi.business.classes.UsersUpdate;

import java.util.List;

import com.sdi.business.UserService;
import com.sdi.business.exception.EntityAlreadyExistsException;
import com.sdi.business.exception.EntityNotFoundException;
import com.sdi.model.User;

public class SimpleUserService implements UserService {

	@Override
	public List<User> getUsers() {
		return new UsersListado().getAlumnos();
	}

	@Override
	public void saveUser(User user) throws EntityAlreadyExistsException {
		new UsersAlta().save(user);
	}

	@Override
	public void updateUser(User alumno) throws EntityNotFoundException {
		new UsersUpdate().update(alumno);
	}

	@Override
	public void deleteUser(User user) throws EntityNotFoundException {
		new UsersBaja().delete(user);
	}

	@Override
	public User findByNick(String id) throws EntityNotFoundException {
		return new UsersBuscar().find(id);
	}
}
